home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_10_02 / 1002109b < prev    next >
Encoding:
Text File  |  1991-12-03  |  310 b   |  14 lines

  1.  
  2.    int index;   
  3.    #define SIZE_OUT_STRINGS 4
  4.  
  5.    char *out_strings[SIZE_OUT_STRINGS] 
  6.        = {"zero", "one", "two", "lots"}; 
  7.  
  8.    if (x < 0 || x >= SIZE_OUT_STRINGS - 1)
  9.        index = SIZE_OUT_STRINGS - 1;
  10.    else
  11.        index = x;  
  12.    printf ("The value is '%s'\n", out_strings[index]);
  13.  
  14.